//
//  DDAnswerRootVC.m
//  dingdang
//
//  Created by 阮 沧晖 on 15/6/28.
//  Copyright (c) 2015年 阮 沧晖. All rights reserved.
//

#import "DDAnswerRootVC.h"
#import "DLTabedSlideView.h"
#import "DDTabEncryptionVC.h"
#import "DDTabRewardVC.h"
#import "DDTabHelpVC.h"
#import "AFURLSessionManager.h"
#import "AFHTTPSessionManager.h"
@interface DDAnswerRootVC ()



@end

@implementation DDAnswerRootVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self createUI];
    [self createData];

}


- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = YES;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - private
- (void)createUI
{

[[NSNotificationCenter defaultCenter]  addObserver:self selector:@selector(gotoVC:) name:@"gotoVC" object:nil];
    
    self.tabedSlideView.delegate = self;
    self.navigationController.navigationBarHidden = YES;
    // Do any additional setup after loading the view from its nib.
    //    self.tabedSlideView.viewControllers = @[ctrl1, ctrl2, ctrl3];
    self.tabedSlideView.baseViewController = self;
    self.tabedSlideView.tabItemNormalColor = [UIColor blackColor];
    self.tabedSlideView.tabItemSelectedColor = [UIColor colorWithRed:0.833 green:0.052 blue:0.130 alpha:1.000];
    self.tabedSlideView.tabbarTrackColor = [UIColor clearColor];//[UIColor colorWithRed:0.833 green:0.052 blue:0.130 alpha:1.000];
    self.tabedSlideView.tabbarBackgroundImage = [UIImage imageNamed:@"tabbarBk"];
    self.tabedSlideView.tabbarBottomSpacing = 3.0;
    
    DLTabedbarItem *item1 = [DLTabedbarItem itemWithTitle:@"加密" image:nil selectedImage:nil];
    DLTabedbarItem *item2 = [DLTabedbarItem itemWithTitle:@"悬赏" image:nil selectedImage:nil];
    DLTabedbarItem *item3 = [DLTabedbarItem itemWithTitle:@"大家帮" image:nil selectedImage:nil];
    self.tabedSlideView.tabbarItems = @[item1, item2, item3];
    [self.tabedSlideView buildTabbar];
    
    self.tabedSlideView.selectedIndex = 0;
}
- (void)createData
{
}

- (void)gotoVC:(NSNotification *)note
{
    UIViewController *VC = note.object;
    [self.navigationController pushViewController:VC animated:YES];
    
}


- (NSInteger)numberOfTabsInDLTabedSlideView:(DLTabedSlideView *)sender{
    return 3;
}
- (UIViewController *)DLTabedSlideView:(DLTabedSlideView *)sender controllerAt:(NSInteger)index{
    switch (index) {
        case 0:
        {
            DDTabEncryptionVC *ctrl = [[DDTabEncryptionVC alloc] initWithNibName:@"DDTabEncryptionVC" bundle:nil];
            return ctrl;
        }
        case 1:
        {
            DDTabRewardVC *ctrl = [[DDTabRewardVC alloc] initWithNibName:@"DDTabRewardVC" bundle:nil];
            return ctrl;
        }
        case 2:
        {
            DDTabHelpVC *ctrl = [[DDTabHelpVC alloc] initWithNibName:@"DDTabHelpVC" bundle:nil];
            return ctrl;
        }
            
        default:
            return nil;
    }
}

@end
